/**
 * 图库统计
 */
import randomFilePicker from '../src/random.js';

export class count extends plugin {
    constructor() {
        super({
            name: '角色图库统计',
            dsc: '角色图库统计',
            event: 'message',
            priority: 500,
            rule: [
                {
                    reg: "^#图库统计",
                    fnc: 'countImageNumber',
                },
            ]
        })
    }
    // 统计图片数量
    async countImageNumber(e) {
        const fileCountList = await randomFilePicker.countFiles();
        let text = '';
        text = `角色图库统计如下：\n`;
        text += fileCountList.map(({ game, character, fileCount, index }) => {
            return `${game}-${character}: ${fileCount}张, 剩余${index}张`;
        }).join('\n');
        //发送消息
        e.reply([text]);
        //返回true 阻挡消息不再往下
        return true;
    }
}